#ifndef SHAPES_H
#define SHAPES_H

#include <QObject>
#include <QGraphicsItem>
#include <QPainter>
#include <QGraphicsSceneMouseEvent>
#include <QCursor>
#include <QMouseEvent>
#include <QPainterPath>
#include <QGraphicsPathItem>
#include <QPointF>
#include <QGraphicsScene>
#include <QGraphicsSceneMouseEvent>
#include <QGraphicsItem>

class shapes: public QObject, public QGraphicsItem
{
    Q_OBJECT
public:
    explicit shapes(QObject *parent = 0);
    virtual ~shapes();
    QString type;
    int size;
    int coordX;
    int coordY;
    qreal ang;
    QPen pen;
    void mouseMoveEvent(QGraphicsSceneMouseEvent * event);
    void mouseReleaseEvent(QGraphicsSceneMouseEvent * event);
    void mousePressEvent(QGraphicsSceneMouseEvent * event);
    void mouseDoubleClickEvent(QMouseEvent *event);
    void machinators();
    //void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
private:
    bool check=false;
    bool check2=false;
     QGraphicsPolygonItem* dashItem;
     QPolygonF selectionArea;
};

class circle: public shapes{
public:
    circle();
    circle(QString _type)
    {
        type = _type;
    }
    circle(QString _type, int _size, int _coordX, int _coordY,qreal _ang)
    {
        type = _type;
        size = _size;
        coordX = _coordX;
        coordY = _coordY;
        ang = _ang;
    }
    void paint(QPainter *painter, const QStyleOptionGraphicsItem*, QWidget*);
    QRectF boundingRect() const;
    QPainterPath shape() const;
};

class square: public shapes{
public:
    square(QString _type)
    {
        type = _type;
    }
    square(QString _type, int _size, int _coordX, int _coordY,qreal _ang)
    {
        type = _type;
        size = _size;
        coordX = _coordX;
        coordY = _coordY;
        ang = _ang;
    }
    void paint(QPainter *painter, const QStyleOptionGraphicsItem*, QWidget*);
    QRectF boundingRect() const;
};

class triangle: public shapes{
public:
    triangle(QString _type)
    {
        type = _type;
    }
    triangle(QString _type, int _size, int _coordX, int _coordY,qreal _ang)
    {
        type = _type;
        size = _size;
        coordX = _coordX;
        coordY = _coordY;
        ang = _ang;
    }
    void paint(QPainter *painter, const QStyleOptionGraphicsItem*, QWidget*);
    QRectF boundingRect() const;
    QPainterPath shape() const;

};

#endif // SHAPES_H
